<?php
/**
 * @file
 * Returns the HTML for a node.
 *
 * Complete documentation for this file is available online.
 * @see https://drupal.org/node/1728164
 */
?>

<?php
$item = node_load(arg(1));
$data = [];
//var_dump($item);
if (isset($item->field_about_list) && !empty($item->field_about_list)) {
//  echo 'aaa';exit;
  $field_about_list = $item->field_about_list[LANGUAGE_NONE];
  foreach ((array) $field_about_list as $key => $value) {
    $item = field_collection_item_revision_load($value['revision_id']);
    $data[$key]['title'] = get_field_value('field_title', $item);
    $data[$key]['content'] = get_field_value('field_tab_content', $item ,TRUE);
    $data[$key]['show'] = get_field_value('field_product_tab_down', $item);
  }
}
?>


<div class="g-col g-col-2">
  <div class="par parsys">
    <div class="accordion">
      <div class="mod mod-accordion">
        <div class="parsys accordionItems">
          <?php foreach ($data as $k => $v) { ?>
            <div class="item">
              <div class="accordion-element-wrapper">
                <section
                  class="accordion-element js-accordion-element ga-accordion <?= $v['show'] == 1 ? 'active' : '' ?>">
                  <a href="javascript:;" class="accordion-link js-accordion-link">
                    <h3 class="headline">
                      <?= $v['title'] ?> <i class="icon-arrow-down"></i>
                    </h3>
                  </a>
                  <div class="accordion-content js-accordion-content">
                    <div class="parsys">
                      <div class="textimage">
                        <div class="mod mod-text-image skin-text-only clearfix">
                          <div class="mod mod-media-lightbox">
                            <div class="content rich">
                                    <?= $v['content'][0] ?>
                                  </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </section>
              </div>
            </div>
          <?php } ?>
        </div>
      </div>
    </div>
  </div>
</div>
